Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Conversation

@bogdan-evtushenko
Copy link
Collaborator

No description provided.

Copy link
Owner

@yev-kanivets yev-kanivets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very well 👍 Fix the code style comments and merge it.

import java.util.*
import javax.inject.Inject

/**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment, please :)

private lateinit var uiDecorator: AddRecordUiDecorator
private lateinit var autoCompleter: CategoryAutoCompleter

override fun getContentViewId(): Int {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be one-lined.

super.initData()
appComponent.inject(this)

uiDecorator = AddRecordUiDecorator(this)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be moved to initViews? It will allow to have all lateinit properties in one place.

if (mode == Mode.MODE_EDIT) {
record?.let { record ->
etTitle.setText(record.title)
if (record.category != null) etCategory.setText(record.category?.name.orEmpty())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just etCategory.setText(record.category?.name.orEmpty()) may work.

uiDecorator.decorateActionBar(supportActionBar, mode, type)
presentSpinnerAccount()

val categoryAutoCompleteAdapter = CategoryAutoCompleteAdapter(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block can be extracted as initCategoryAutocomplete.

tvTime.text = formatController.formatTime(timestamp)
}

enum class Mode {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One-line.


@Override
public View getView(int position, View convertView, ViewGroup parent) {
public View getView(int position, View convertView, @NotNull ViewGroup parent) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return convertView;
}

@Override
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

List<String> tempList;

if (constraint != null) tempList = autoCompleter.completeByPart(constraint.toString());
if (constraint != null)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One-line if possible.

*/
public class CategoryAutoCompleteAdapter extends ArrayAdapter<String> implements Filterable {
private final CategoryAutoCompleter autoCompleter;
private List<String> resultList;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refacto 👍

@bogdan-evtushenko bogdan-evtushenko merged commit 24a16ff into dev Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants